<style lang="scss" scoped>
    .bg{
        background: url('./search_bg.png') no-repeat center;
        background-size: 90%;
    }
    .delete{

        width:20px;

        height:20px;

        border-radius:60%;

        position:absolute;

        top:10px;

        right:10px;

}
</style>


<template>
    <ui-main class="pl5 pr5 bg-white">
        <div v-if="!img_show" class="flex row-center col-center h-100 bg">
            <div style="width:80%;text-align:center">

                <div class="search relative">
                    <van-field v-model="searchVal" placeholder="请输入业务单号查询" @clear="onClear" @click-icon="onSearch" icon="search"></van-field>
                </div>
            </div>
        </div>
        <div v-else class=" h-100">

            <div  class="flex row-center col-center h-100">
                <img width="100%" :src="imgurl" alt="">
                <div class="delete" @click="onClick" >
                    <img src="./close.png" alt="">
                </div>
            </div>
        </div>

    </ui-main>
</template>

<script>
    import yw from '../mixins/ljy';

    export default {
        mixins: [yw],
        data() {
            return {
                imgurl:'',
                searchShow:true,
                img_show: false,
                searchVal:''
            };
        },
        mounted() {
            this.$title((this.$route.query.business_name?this.$route.query.business_name:'') + '状态查询')
        },
        methods:{
            onSearch(){
                var params = {
                    org_id:this.$route.query.org_id,
                    business_name:this.$route.query.business_name,
                    order_no:this.searchVal
                }
                this.$$getAllBusinessStatus(params).then(data => {
                    if (this.$isArray(data.content) && data.content.length > 0) {
                        this.imgurl = this.$serverUrl + data.content[0].business_url
                        this.img_show = true
                    }
                }).catch(e => {
                    console.error(e);
                });
            },
            onClear(){
                this.searchVal = ''
            },
            onClick(){
                this.img_show = !this.img_show
            }
        },
        // watch:{
        //     searchVal(){
        //         this.loadData()
        //     }
        // }
    }
</script>

<style lang="scss">
    img {
        max-width: 100%;
    }
</style>
